// import { registerMicroApps, start, setDefaultMountApp, initGlobalState } from 'qiankun';

import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter as Router } from "react-router-dom";
import App from "./App";
// redux
import { Provider } from "react-redux";
import { createStore } from "redux";
import reducer from "./redux/reducers";
import store from "./redux/store";

// import { genActiveRule } from "./util";  // 导入路由监听函数

render({ loading: true }); // 初次渲染主应用

function Render(props) {
  return (
    // <React.StrictMode>
    <Provider store={store}>
      <Router>
        <App>
          {/* {loading && (
            <h4 className="subapp-loading">Loading...</h4>
          )} */}
          <div id="subapp-viewport" />
        </App>
      </Router>
    </Provider>
    // </React.StrictMode>
  );
}

function render({ appContent, loading }) {
  ReactDOM.render(
    <Render appContent={appContent} loading={loading} />,
    document.querySelector("#root")
  );
}

// let hostname = `${window.location.origin}/demo`
